<html>
    <body>
        <h1>我的订单</h1>
        <p>
            <br> 发票编号： {{ order.id }}</br>
            <span class="secondary">
            {{ order.created|date:"M d, Y" }}
            </span>
        </p>
        <h3>付款方</h3>
        <p>
            {{ order.first_name }} {{ order.last_name }}<br>
            {{ order.email }}<br>
            {{ order.address }}<br>
            {{ order.postal_code }}, {{ order.city }}
        </p>
        <h3>已买商品</h3>
        <table>
            <thead>
                <tr>
                    <th>商品</th>
                    <th>价格</th>
                    <th>数量</th>
                    <th>费用</th>
                </tr>
            </thead>
            <tbody>
                {% for item in order.items.all %}
                    <tr class="row{% cycle "1" "2" %}">
                        <td>{{ item.product.name }}</td>
                        <td class="num">${{ item.price }}</td>
                        <td class="num">{{ item.quantity }}</td>
                        <td class="num">${{ item.get_cost }}</td>
                    </tr>
                {% endfor %}
                <tr class="total">
                    <td colspan="3">Total</td>
                    <td class="num">${{ order.get_total_cost }}</td>
                </tr>
            </tbody>
        </table>
        <span class="{% if order.paid %}paid{% else %}pending{% endif %}">
        {% if order.paid %}Paid{% else %}Pending payment{% endif %}
        </span>
    </body>
</html>
